package com.karolak.stock.oscilator;

import com.karolak.stock.data.DataManager;
import com.karolak.stock.indicator.Indicator;

public class Oscilator extends Indicator {

	public Oscilator(String name, DataManager dataManager, int period, Indicator input) {
		super(name, dataManager, period, input);
	}
	
	public Oscilator(DataManager dataManager, int period, Indicator input) {
		super(dataManager, period, input);
		String name = super.getName();
		name = name.endsWith("Osc") ? name.replace("Osc", "") : name;
		setName(name);
	}
	
	@Override
	public double execute(double x) {
		double v = getDataManager().getLast(getInput().getName());
		return v;
	}	
}
